<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="menu" content="col1Menu" />
<meta name="nav" content="2" />
<meta name="acc" content="info" />
<title>事故信息</title>
<script type="text/javascript"
	src="<c:url value='/ext/ui/jquery-ui-1.8.12.custom.min.js'/>"></script>
<link href="${ctx}/styles/lightness/jquery-ui-1.8.12.custom.css"
	rel="stylesheet" />
<script type='text/javascript' src='${ctx}/scripts/plugin/jquery.autocomplete.js'></script>
<script type="text/javascript">
	$(document).ready(
			function() {
				$("input[name='happendate']").addClass("Wate").bind("click",
						function() {
							WdatePicker({
								skin : 'whyGreen',
								minDate : '1900-10-01',
								maxDate : '%y-%M-%d',
								dateFmt : 'yyyy-MM-dd'
							});
						});
				
				//自动补全
				 $("#projname").autocomplete('${ctx}/project/projectinfo!projlist.action', {
						multiple: false,
						dataType: "json",
						minChars: 0,
						delay: 100,
						autoFill: false,
						parse: function(data) {
							return $.map(data, function(row) {
								return {
									data: row,
									value: row.projId,
									result:  row.projName 
								}
							});
						},
						formatItem: function(item) {
							return item.projName ;
						}
					}).result(function(e, item) {
							 $("#projname").val(item.projName);
						     $("#pid").val(item.projId);
					});		
		
				
		$("#inputForm").validate({
			rules:{
				deaths:{
					required: true,
					digits:true
				},
				loss:{
					required: true,
					 number:true
				}
			}
		});
	});
</script>
</head>
<body>
<div id="heading" class="accidentreport"><h6>事故处理</h6></div>
<form action="accidentreport!save.action" method="post" id="inputForm"
	class="yform" enctype="multipart/form-data"><input
	type="hidden" id="id" name="id" value="${id}">
<div>
<table class="noborder">
	<tr class="type-text">
		<td>项目名称</td>
		<td><input type="text" id="projname" name="projname" value="${projname}">
		<input type="hidden" id="pid" name="pid" value="${pid}">
		</td>
		<td>事故类型</td>
		<td><pt:code category="3013" name="type" default="${type}"></pt:code>
		</td>
	</tr>
	<tr class="type-text">
		<td>发生时间</td>
		<td><input type="text" name="happendate"
			value="<fmt:formatDate value="${happendate}" pattern="yyyy-MM-dd"/>"></td>
		<td>发生地点</td>
		<td><input name="happenplace" value="${happenplace}" type="text">
		</td>
	</tr>

	<tr class="type-text">
		<td>死亡人数</td>
		<td><input type="text" name="deaths" value="${deaths }"></td>
		<td>损失</td>
		<td><input name="loss" value="${loss}" type="text"></td>
	</tr>


	<tr class="type-text">
		<td>简要经过</td>
		<td colspan="3"><input type="text" id="content" name="content"
			value="${content }"></td>
	</tr>
	<tr class="type-text">
		<td>造成工程损坏情况</td>
		<td colspan="3"><input type="text" id="damage" name="damage"
			value="${damage}"></td>
	</tr>
	<tr class="type-text">
		<td>原因初步判断</td>
		<td colspan="3"><input type="text" id="reason" name="reason"
			value="${reason}"></td>
	</tr>
	<tr class="type-text">
		<td>事故报告单位</td>
		<td colspan="3"><input type="text" id="reportorg"
			name="reportorg" value="${reportorg}"></td>
	</tr>
	<tr class="type-text">
		<td>事故采取措施</td>
		<td colspan="3"><input type="text" id="measure" name="measure"
			value="${measure}"></td>
	</tr>
	<tr class="type-text">
		<td>附件</td>
		<td colspan="3"><input type="file"
			name="accidentAttachment.upfile"></td>
	</tr>
	<c:if test="${not empty contfile.id}">
		<tr id="attachment">
			<td>已有附件</td>
			<td><a title="下载"
				href="${ctx}/servlet/annex?id=${contfile.id}">${contfile.upfileFileName}</a>
			<a href="javascript:deleteAttachment('${contfile.id}')"
				class="delete">删除</a></td>
		</tr>
	</c:if>
	<tr class="type-text">
		<td>备注</td>
		<td colspan="3"><textarea name="remark" id="remark">${remark }</textarea>
		</td>
	</tr>
</table>
</div>
<div class="type-button"><input class="button" type="submit"
	class="submit" value="新增" />&nbsp;</div>
</form>
</body>
</html>